package com.tl.juc.c3;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class C3_ThreadLocalOOM {
    public static void main(String[] args) {
        ThreadLocal<User> userL = new ThreadLocal<>();

        ExecutorService executorService = Executors.newFixedThreadPool(30);
        for (int i=0;i<30;i++){
            executorService.execute(() ->{
                userL.set(new User());
                userL.remove();
            });
            try {
                Thread.sleep(1000);
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }
        executorService.shutdown();
    }
}
